package com.itheima.blog.admin.controller;


import com.itheima.blog.admin.dto.PageDto;
import com.itheima.blog.admin.domain.po.TWebNavbar;
import com.itheima.blog.admin.service.ITWebNavbarService;
import com.itheima.blog.admin.vo.PageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 门户网站首页导航栏 前端控制器
 * </p>
 *
 * @author author
 * @since 2023-07-13
 */
@RestController
@RequestMapping("/admin/index/route")
@Api(value = "门户管理")
@RequiredArgsConstructor
public class TWebNavbarController {

    private final ITWebNavbarService itWebNavbarService;
    @PostMapping
    @ApiOperation("新增导航栏")
    public void insertRoute(@RequestBody TWebNavbar tWebNavbar){
        itWebNavbarService.insertRoute(tWebNavbar);
    }

    @PostMapping("/{routeId}")
    @ApiOperation("修改导航栏")
    public void updateRoute(@RequestBody TWebNavbar tWebNavbar,@PathVariable("routeId") Integer routeId){
        itWebNavbarService.updateRoute(tWebNavbar,routeId);
    }

    @DeleteMapping
    @ApiOperation("删除导航栏")
    public void deleteRoute(Integer routeId){
        itWebNavbarService.deleteRoute(routeId);
    }

    @PostMapping("/list")
    @ApiOperation("列表展示")
    public PageVO<TWebNavbar> selectAll(@RequestBody PageDto pageDto){
        return itWebNavbarService.selectAll(pageDto);
    }

}
